//
//  YYMineView.m
//  drivingSchool
//
//  Created by 子yu 刘 on 2018/9/19.
//  Copyright © 2018年 子yu 刘. All rights reserved.
//

#import "YYMineView.h"

@implementation YYMineView{
    UILabel * _lbTitle;
    UIImageView * _icon;
}

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}

- (void)creatUI{
    self.backgroundColor = [UIColor whiteColor];
    UIImageView * icon = [[UIImageView alloc] init];
    [self addSubview:icon];
    _icon = icon;
    UILabel * title = [[UILabel alloc] init];
    title.font = [UIFont systemFontOfSize:14.0];
    title.textColor = [UIColor colorWithHexString:@"333333"];
    _lbTitle = title;
    [self addSubview:title];
    [icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_offset(24);
        make.width.mas_offset(25);
        make.height.mas_offset(25);
    }];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.bottom.mas_offset(-20);
    }];
    UIView * line1 = [[UIView alloc] init];
    [self addSubview:line1];
    UIView * line2 = [[UIView alloc] init];
    [self addSubview:line2];
    line1.backgroundColor = [UIColor colorWithHexString:@"e6e6e6"];
    line2.backgroundColor = [UIColor colorWithHexString:@"e6e6e6"];
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.top.bottom.mas_equalTo(0);
        make.width.mas_offset(1);
    }];
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.height.mas_offset(1);
    }];
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)];
    [self addGestureRecognizer:tap];
}
- (void)tap{
    if (_clickdeBlock) {
        _clickdeBlock();
    }
}

-(void)setDataWithDict:(NSDictionary *)dict{
    [_icon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",DEF_INTERFACE_WEBVIEWSERVICE,dict[@"image"]]]];
    _lbTitle.text = dict[@"title"];
    
}
@end
